import { defineConfig } from 'vitepress'

// 公共配置项
const BASE_CONFIG = {
  title: "THINK-AWD",
  description: "网络攻防训练平台",
  lang: 'zh-CN', // 新增国际化配置
  head: [
    ['meta', { name: 'theme-color', content: '#3eaf7c' }],
    // 添加图标
    ['link', { rel: 'icon', href: '/favicon.svg' }]
  ]
}

// 导航栏配置
const NAV = [
  { text: '首页', link: '/' },
  { text: '快速开始', link: '/quickly-start/' },
  { text: '二次开发', link: '/second-develop/' },
  { text: '开发规范', link: '/develop-specification/' }
]

// 侧边栏配置
const SIDEBAR = {
  '/quickly-start/': [
    {
      text: '快速开始',
      collapsed: false, // 默认展开
      base: '/quickly-start/',
      items: [
        { text: '准备环境', link: 'prepare-environment' },
        { text: '配置文件说明', link: 'configuration-file-description' },
        { text: '如何启动', link: 'how-to-start' },
        { text: '赛题管理', link: 'comp-question-manger' }
      ]
    }
  ],
  '/second-develop/': [
    {
      text: '二次开发',
      collapsed: false,
      base: '/second-develop/',
      items: [
        { text: '如何开发', link: 'how-to-develop' }
      ]
    }
  ],
  '/develop-specification/': [
    {
      text: '开发规范',
      collapsed: false,
      base: '/develop-specification/',
      items: [
        { text: '项目结构', link: 'project-structure' },
        { text: '后端规范', link: 'backend' },
        { text: '前端规范', link: 'frontend' },
        { text: '数据库规范', link: 'database' }
      ]
    }
  ]
}

export default defineConfig({
  ...BASE_CONFIG,
  themeConfig: {
    nav: NAV,
    sidebar: SIDEBAR,

    // 修复上一页/下一页配置
    docFooter: {
      prev: '上一节',
      next: '下一节'
    },
    outline: {
      level: 'deep', // 允许跨标题级别导航
      label: '本页目录'
    },
    // 增强型相邻导航（VitePress 1.0+）
    sidebarMenuLabel: '目录',
    returnToTopLabel: '返回顶部',
    // 社交链接
    socialLinks: [
      { icon: 'gitee', link: 'https://gitee.com/mo_zhenshuang/think-awd-training-platform' }
    ],
    // 对 markdown 的配置
    markdown: {
      
    },
    // 页脚配置
    footer: {
      message: 'Released under the MulanPSL2 License.',
      copyright: 'Copyright © 2024-2025 Think' // 修正年份格式
    },

    // 增强可访问性
    outline: {
      label: '目录'
    }
  }
})